<template>
    <div>
        <el-form label-width="100px" ref="AddIntangibleAssets_refs" :model="IntangibleAssetsModel">
            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="申请号" prop="ApplicationNumber">
                        <el-input v-model="IntangibleAssetsModel.ApplicationNumber"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="申请日期" prop="FilingDate">
                        <el-date-picker style="width: 100%" placeholder="申请日期"
                                        type="date"
                                        value-format="yyyy-MM-dd hh:mm:dd"
                                        v-model="IntangibleAssetsModel.FilingDate"></el-date-picker>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="申请人" prop="Applicant">
                        <el-input v-model="IntangibleAssetsModel.Applicant"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="发明人" prop="Inventor">
                        <el-input v-model="IntangibleAssetsModel.Inventor"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="类型" prop="PatentType">
                        <el-select style="width: 100%" v-model="IntangibleAssetsModel.PatentType">
                            <el-option :value="1" label="软件著作"></el-option>
                            <el-option :value="2" label="发明专利"></el-option>
                            <el-option :value="4" label="实用新型专利"></el-option>
                            <el-option :value="8" label="商标"></el-option>
                            <el-option :value="16" label="其它"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="专利名称" prop="PatentName">
                        <el-input v-model="IntangibleAssetsModel.PatentName"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="状态" prop="state">
                        <el-select style="width: 100%" v-model="IntangibleAssetsModel.state">
                            <el-option :value="1" label="受理阶段"></el-option>
                            <el-option :value="2" label="申请阶段"></el-option>
                            <el-option :value="4" label="初审阶段"></el-option>
                            <el-option :value="8" label="实审阶段"></el-option>
                            <el-option :value="16" label="取证阶段"></el-option>
                            <el-option :value="32" label="其它"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="授权公告日" prop="AuthorizedAnnouncementDate">
                        <el-date-picker style="width: 100%" placeholder="授权公告日"
                                        type="date"
                                        value-format="yyyy-MM-dd hh:mm:dd"
                                        v-model="IntangibleAssetsModel.AuthorizedAnnouncementDate"></el-date-picker>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row>
                <el-col :span="21" :offset="1">
                    <el-form-item label="备注" prop="Remark">
                        <el-input type="textarea" v-model="IntangibleAssetsModel.Remark"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-divider content-position="left">上传图片信息</el-divider>

            <div>
                <el-button type="primary">选择多文件(暂时无用)</el-button>
                <el-table stripe :data="imageTableData">
                    <el-table-column label="文件名" show-overflow-tooltip prop="name" align="center"></el-table-column>
                    <el-table-column label="大小" show-overflow-tooltip prop="size" align="center"></el-table-column>
                    <el-table-column label="状态" show-overflow-tooltip align="center">
                        <template>
                            <label>等待上传</label>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" align="center">
                        <template slot-scope="slot">
                            <el-button type="primary" size="mini" >重传</el-button>
                            <el-button type="danger" size="mini" >删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>

            <el-row>
                <el-col align="center" style="margin-top: 10px">
                    <el-button type="primary" @click="AddIntangibleAssetsDB_event">立即提交</el-button>
                    <el-button type="info" @click="formresetFields_event">重置</el-button>
                </el-col>
            </el-row>

        </el-form>
    </div>
</template>

<script>
    export default {
        name: "AddIntangibleAssets",
        data() {
            return {
                //上传图片信息集合
                imageTableData: [],
                // 无形资产实体
                IntangibleAssetsModel: {
                    ApplicationNumber: '',
                    FilingDate: new Date(),
                    Applicant: '',
                    Inventor: '',
                    PatentType: '',
                    PatentName: '',
                    state: '',
                    AuthorizedAnnouncementDate: new Date(),
                    Remark: '',
                },
            }
        },
        methods: {
            //重置表格
            formresetFields_event() {
                this.$refs['AddIntangibleAssets_refs'].resetFields()
            },
            // 添加新产品
            AddIntangibleAssetsDB_event() {
                let loadding = this.openLoading();
                this.$http.post('IntangibleAssets/AddUpIntangibleAssetsDB', this.IntangibleAssetsModel).then(res => {
                    loadding.close();
                    if (res.data.flag) {
                        this.$message.success('添加成功!')
                        this.$parent.$parent.AddIntangibleAssets_dialog = false
                        this.$parent.$parent.formdata()
                        this.formresetFields_event()

                        //region 文件上传
                        let id = res.data.Id
                        //endregion

                    } else {
                        this.$message.warning('添加失败,请重试!')
                    }
                })
            }
        }
    }
</script>

<style scoped>

</style>
